﻿// -----------------------------------------------------------------------
// <copyright file="IContentProviderSubscriptionService.cs" company="Zen Design Corp">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Zen.BlackBerry.Subscription
{
	using System;
	using Zen.BlackBerry.Subscription.Web;

	/// <summary>
	/// Interface which allows a content provider to perform their own subscription actions.
	/// </summary>
	/// <remarks>
	/// <para>
	/// This includes performing actions specific to a content provider when a
	/// user subscribes, unsubscribes, suspends a subscription, or resumes a
	/// subscription to a push application. 
	/// </para>
	/// <para>
	/// A default implementation is provided by the push SDK. However, it is 
	/// the responsibility of the content provider to provide their own 
	/// implementation of this interface if they wish to perform their own 
	/// actions on a subscribe, unsubscribe, suspend, and resume. The content
	/// provider's subscription actions will be called once the SDK has
	/// successfully (or unsuccessfully) completed its own actions.
	/// </para>
	///	</remarks>
	public interface IContentProviderSubscriptionService
	{
		/// <summary>
		/// Allows the content provider to perform an action when the SDK's subscribe triggers an automatic unsubscribe of a user
		/// </summary>
		/// <param name="unsubscribeRequest">The unsubscribe request.</param>
		void OnAutomaticUnsubscribe(UnsubscribeRequest unsubscribeRequest);

		/// <summary>
		/// Allows the content provider to perform an action when the SDK's resume fails.
		/// </summary>
		/// <param name="resumeRequest">The resume request.</param>
		/// <param name="exception">The exception.</param>
		void OnResumeFailure(ResumeRequest resumeRequest, Exception exception);

		/// <summary>
		/// Allows the content provider to perform an action when the SDK's resume is successful.
		/// </summary>
		/// <param name="resumeRequest">The resume request.</param>
		void OnResumeSuccess(ResumeRequest resumeRequest);

		/// <summary>
		/// Allows the content provider to perform an action when the SDK's subscribe fails.
		/// </summary>
		/// <param name="subscribeRequest">The subscribe request.</param>
		/// <param name="exception">The exception.</param>
		void OnSubscribeFailure(SubscribeRequest subscribeRequest, Exception exception);

		/// <summary>
		/// Allows the content provider to perform an action when the SDK's subscribe is successful.
		/// </summary>
		/// <param name="subscribeRequest">The subscribe request.</param>
		void OnSubscribeSuccess(SubscribeRequest subscribeRequest);

		/// <summary>
		/// Allows the content provider to perform an action when the SDK's suspend fails.
		/// </summary>
		/// <param name="suspendRequest">The suspend request.</param>
		/// <param name="exception">The exception.</param>
		void OnSuspendFailure(SuspendRequest suspendRequest, Exception exception);

		/// <summary>
		/// Allows the content provider to perform an action when the SDK's suspend is successful. 
		/// </summary>
		/// <param name="suspendRequest">The suspend request.</param>
		void OnSuspendSuccess(SuspendRequest suspendRequest);

		/// <summary>
		/// Allows the content provider to perform an action when the SDK's unsubscribe fails.
		/// </summary>
		/// <param name="unsubscribeRequest">The unsubscribe request.</param>
		/// <param name="exception">The exception.</param>
		void OnUnsubscribeFailure(UnsubscribeRequest unsubscribeRequest, Exception exception);

		/// <summary>
		/// Allows the content provider to perform an action when the SDK's unsubscribe is successful.
		/// </summary>
		/// <param name="unsubscribeRequest">The unsubscribe request.</param>
		void OnUnsubscribeSuccess(UnsubscribeRequest unsubscribeRequest);
	}
}
